#include <stdio.h>
#include <unistd.h>

int main(){
    //1.创建子进程
    pid_t ret = fork();
    if(ret < 0){
        perror("fork");
        return 0;
    }else if(ret == 0){
        //child
        printf("i am child process, pid is %d, ppid is %d\n", getpid(), getppid());
    }else{
        // >0 father
        while(1){
            printf("i am father process, pid is %d\n", getpid());
            sleep(1);
        }
    }
    return 0;
}
